<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../vue.js"></script>
</head>

<body>
  <div id="app">
    <h1>
      {{username}}
    </h1>
    <costom-input v-model="username"></costom-input>

    <!-- <input type="text" v-model="username" > -->
    <!-- <input type="text" :value="username" @input="username=$event.target.value" > -->

  </div>
  <script>

    Vue.component('costom-input', {
      props:['value'],
      template: `
      <input :value='value'  type="text" @input="handleInput"/>
      
      `,
      methods:{
        handleInput(event){
          this.$emit('input',event.target.value)
        }
      }

    })

    var vm = new Vue({
      el: "#app",
      data: {
        username: 'admin'
      }
    })

  </script>

</body>

</html>